﻿using System;
using System.Windows.Forms;
using BillGuru.Persistence;

namespace BillGuru
{
    public partial class FrmVendor : Form
    {
        public FrmVendor()
        {
            InitializeComponent();
        }

        private void vendorBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.vendorBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.billGuruDataSet);

        }

        private void FrmVendor_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'billGuruDataSet.Vendor' table. You can move, or remove it, as needed.
            this.vendorTableAdapter.Fill(this.billGuruDataSet.Vendor);
            this.vendorTableAdapter.Adapter.RowUpdated += new System.Data.OleDb.OleDbRowUpdatedEventHandler(Adapter_RowUpdated);
        }

        void Adapter_RowUpdated(object sender, System.Data.OleDb.OleDbRowUpdatedEventArgs e)
        {
            SharedEventHandlerImpl.RetrieveKeyOnRowInsert(sender, e);
        }

        private void FrmVendor_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.billGuruDataSet.HasChanges())
                BillGuru.UI.PermissionHandler.checkDataLoss(e);
        }
    }
}
